﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCoreLib.Data
{

    public interface IDbTransactionObject : IDisposable
    {
        /// <summary>
        /// Commits the database transaction.
        /// </summary>
        /// <exception cref="T:System.Exception">An error occurred while trying to commit the transaction. </exception><exception cref="T:System.InvalidOperationException">The transaction has already been committed or rolled back.-or- The connection is broken. </exception><filterpriority>2</filterpriority>
        void Commit();

        /// <summary>
        /// Rolls back a transaction from a pending state.
        /// </summary>
        /// <exception cref="T:System.Exception">An error occurred while trying to commit the transaction. </exception><exception cref="T:System.InvalidOperationException">The transaction has already been committed or rolled back.-or- The connection is broken. </exception><filterpriority>2</filterpriority>
        void Rollback();

        /// <summary>
        /// Gets the Connection object to associate with the transaction.
        /// </summary>
        /// <returns>
        /// The Connection object to associate with the transaction.
        /// </returns>
        IDbClientObject Connection { get; }

        /// <summary>
        /// Gets the <see cref="T:System.Data.IsolationLevel"/> for this transaction.
        /// </summary>
        /// <returns>
        /// The <see cref="T:System.Data.IsolationLevel"/> for this transaction. The default is ReadCommitted.
        /// </returns>
        IsolationLevel IsolationLevel { get; }
    }
}
